(0) Obligation:

The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(1, 1).


The TRS R consists of the following rules:

d(x) → e(u(x))
d(u(x)) → c(x)
c(u(x)) → b(x)
v(e(x)) → x
b(u(x)) → a(e(x))

Rewrite Strategy: INNERMOST

(1) TrsToWeightedTrsProof (BOTH BOUNDS(ID, ID) transformation)

Transformed TRS to weighted TRS

(2) Obligation:

The Runtime Complexity (innermost) of the given CpxWeightedTrs could be proven to be BOUNDS(1, 1).


The TRS R consists of the following rules:

d(x) → e(u(x)) [1]
d(u(x)) → c(x) [1]
c(u(x)) → b(x) [1]
v(e(x)) → x [1]
b(u(x)) → a(e(x)) [1]

Rewrite Strategy: INNERMOST

(3) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)

Infered types.

(4) Obligation:

Runtime Complexity Weighted TRS with Types.
The TRS R consists of the following rules:

d(x) → e(u(x)) [1]
d(u(x)) → c(x) [1]
c(u(x)) → b(x) [1]
v(e(x)) → x [1]
b(u(x)) → a(e(x)) [1]

The TRS has the following type information:
d :: u → e:a
e :: u → e:a
u :: u → u
c :: u → e:a
b :: u → e:a
v :: e:a → u
a :: e:a → e:a

Rewrite Strategy: INNERMOST

(5) CompletionProof (UPPER BOUND(ID) transformation)

The TRS is a completely defined constructor system, as every type has a constant constructor and the following rules were added:

c(v0) → null_c [0]
v(v0) → null_v [0]
b(v0) → null_b [0]

And the following fresh constants:

null_c, null_v, null_b

(6) Obligation:

Runtime Complexity Weighted TRS where all functions are completely defined. The underlying TRS is:

Runtime Complexity Weighted TRS with Types.
The TRS R consists of the following rules:

d(x) → e(u(x)) [1]
d(u(x)) → c(x) [1]
c(u(x)) → b(x) [1]
v(e(x)) → x [1]
b(u(x)) → a(e(x)) [1]
c(v0) → null_c [0]
v(v0) → null_v [0]
b(v0) → null_b [0]

The TRS has the following type information:
d :: u:null_v → e:a:null_c:null_b
e :: u:null_v → e:a:null_c:null_b
u :: u:null_v → u:null_v
c :: u:null_v → e:a:null_c:null_b
b :: u:null_v → e:a:null_c:null_b
v :: e:a:null_c:null_b → u:null_v
a :: e:a:null_c:null_b → e:a:null_c:null_b
null_c :: e:a:null_c:null_b
null_v :: u:null_v
null_b :: e:a:null_c:null_b

Rewrite Strategy: INNERMOST

(7) CpxTypedWeightedTrsToRntsProof (UPPER BOUND(ID) transformation)

Transformed the TRS into an over-approximating RNTS by (improved) Size Abstraction.
The constant constructors are abstracted as follows:

null_c => 0
null_v => 0
null_b => 0

(8) Obligation:

Complexity RNTS consisting of the following rules:

b(z) -{ 0 }→ 0 :|: v0 >= 0, z = v0
b(z) -{ 1 }→ 1 + (1 + x) :|: x >= 0, z = 1 + x
c(z) -{ 1 }→ b(x) :|: x >= 0, z = 1 + x
c(z) -{ 0 }→ 0 :|: v0 >= 0, z = v0
d(z) -{ 1 }→ c(x) :|: x >= 0, z = 1 + x
d(z) -{ 1 }→ 1 + (1 + x) :|: x >= 0, z = x
v(z) -{ 1 }→ x :|: x >= 0, z = 1 + x
v(z) -{ 0 }→ 0 :|: v0 >= 0, z = v0

Only complete derivations are relevant for the runtime complexity.

(9) CompleteCoflocoProof (EQUIVALENT transformation)

Transformed the RNTS (where only complete derivations are relevant) into cost relations for CoFloCo:

eq(start(V),0,[d(V, Out)],[V >= 0]).
eq(start(V),0,[c(V, Out)],[V >= 0]).
eq(start(V),0,[v(V, Out)],[V >= 0]).
eq(start(V),0,[b(V, Out)],[V >= 0]).
eq(d(V, Out),1,[],[Out = 2 + V1,V1 >= 0,V = V1]).
eq(d(V, Out),1,[c(V2, Ret)],[Out = Ret,V2 >= 0,V = 1 + V2]).
eq(c(V, Out),1,[b(V3, Ret1)],[Out = Ret1,V3 >= 0,V = 1 + V3]).
eq(v(V, Out),1,[],[Out = V4,V4 >= 0,V = 1 + V4]).
eq(b(V, Out),1,[],[Out = 2 + V5,V5 >= 0,V = 1 + V5]).
eq(c(V, Out),0,[],[Out = 0,V6 >= 0,V = V6]).
eq(v(V, Out),0,[],[Out = 0,V7 >= 0,V = V7]).
eq(b(V, Out),0,[],[Out = 0,V8 >= 0,V = V8]).
input_output_vars(d(V,Out),[V],[Out]).
input_output_vars(c(V,Out),[V],[Out]).
input_output_vars(v(V,Out),[V],[Out]).
input_output_vars(b(V,Out),[V],[Out]).

CoFloCo proof output:
Preprocessing Cost Relations
=====================================

#### Computed strongly connected components
0. non_recursive : [b/2]
1. non_recursive : [c/2]
2. non_recursive : [d/2]
3. non_recursive : [v/2]
4. non_recursive : [start/1]

#### Obtained direct recursion through partial evaluation
0. SCC is partially evaluated into b/2
1. SCC is partially evaluated into c/2
2. SCC is partially evaluated into d/2
3. SCC is partially evaluated into v/2
4. SCC is partially evaluated into start/1

Control-Flow Refinement of Cost Relations
=====================================

### Specialization of cost equations b/2
* CE 12 is refined into CE [14]
* CE 13 is refined into CE [15]


### Cost equations --> "Loop" of b/2
* CEs [14] --> Loop 10
* CEs [15] --> Loop 11

### Ranking functions of CR b(V,Out)

#### Partial ranking functions of CR b(V,Out)


### Specialization of cost equations c/2
* CE 8 is refined into CE [16,17]
* CE 9 is refined into CE [18]


### Cost equations --> "Loop" of c/2
* CEs [17] --> Loop 12
* CEs [16,18] --> Loop 13

### Ranking functions of CR c(V,Out)

#### Partial ranking functions of CR c(V,Out)


### Specialization of cost equations d/2
* CE 7 is refined into CE [19,20]
* CE 6 is refined into CE [21]


### Cost equations --> "Loop" of d/2
* CEs [21] --> Loop 14
* CEs [20] --> Loop 15
* CEs [19] --> Loop 16

### Ranking functions of CR d(V,Out)

#### Partial ranking functions of CR d(V,Out)


### Specialization of cost equations v/2
* CE 10 is refined into CE [22]
* CE 11 is refined into CE [23]


### Cost equations --> "Loop" of v/2
* CEs [22] --> Loop 17
* CEs [23] --> Loop 18

### Ranking functions of CR v(V,Out)

#### Partial ranking functions of CR v(V,Out)


### Specialization of cost equations start/1
* CE 2 is refined into CE [24,25,26]
* CE 3 is refined into CE [27,28]
* CE 4 is refined into CE [29,30]
* CE 5 is refined into CE [31,32]


### Cost equations --> "Loop" of start/1
* CEs [24,25,26,27,28,29,30,31,32] --> Loop 19

### Ranking functions of CR start(V)

#### Partial ranking functions of CR start(V)


Computing Bounds
=====================================

#### Cost of chains of b(V,Out):
* Chain [11]: 0
with precondition: [Out=0,V>=0]

* Chain [10]: 1
with precondition: [V+1=Out,V>=1]


#### Cost of chains of c(V,Out):
* Chain [13]: 1
with precondition: [Out=0,V>=0]

* Chain [12]: 2
with precondition: [V=Out,V>=2]


#### Cost of chains of d(V,Out):
* Chain [16]: 2
with precondition: [Out=0,V>=1]

* Chain [15]: 3
with precondition: [V=Out+1,V>=3]

* Chain [14]: 1
with precondition: [V+2=Out,V>=0]


#### Cost of chains of v(V,Out):
* Chain [18]: 0
with precondition: [Out=0,V>=0]

* Chain [17]: 1
with precondition: [V=Out+1,V>=1]


#### Cost of chains of start(V):
* Chain [19]: 3
with precondition: [V>=0]


Closed-form bounds of start(V):
-------------------------------------
* Chain [19] with precondition: [V>=0]
- Upper bound: 3
- Complexity: constant

### Maximum cost of start(V): 3
Asymptotic class: constant
* Total analysis performed in 59 ms.

(10) BOUNDS(1, 1)